<?
require_once("lang.php");
require_once($real_path . "functions/search_teaser.php");

ob_start("callback");

$db_detail			= new db_query("SELECT *
											 FROM categories_multi, news_multi, news_hits
											 WHERE cat_id = new_category_id AND new_id = nh_id AND cat_type = 'news' AND cat_active = 1 AND new_active = 1 AND new_id = " . $iData . " AND categories_multi.lang_id = " . $lang_id);
if(mysql_num_rows($db_detail->result) == 0){
	redirect(generate_module_url("notfound"));
}
$rowDetail			= mysql_fetch_assoc($db_detail->result);
$rowType				= $rowDetail;
$module				= $rowType["cat_type"];
$_GET["module"]	= $module;

// Gắn iCat để tạo current
$_GET["iCat"]		= $rowDetail["cat_id"];
$urlType				= generate_type_url($rowType["cat_name"], $rowType["cat_id"]);
$urlDetail			= generate_detail_url($module, $rowDetail["cat_name"], $rowDetail["new_title"], $rowDetail["new_id"]);
$db_detail->close();
unset($db_detail);

// Update hits
$db_execute			= new db_execute("UPDATE news_hits
												SET nh_hits = nh_hits + 1
												WHERE nh_id = " . $rowDetail["new_id"]);
unset($db_execute);

// Cấu hình các thẻ title, meta
$con_site_title	= $rowDetail["new_title"];
$con_meta_description	= removeHTML(search_teaser(removeHTML(replaceFCK($rowDetail["new_description"], 1)), $rowDetail["new_title"]));
$con_meta_description	= removeExcessSpace($con_meta_description);

// Header navigate
$class_menu			= new menu();
$header_navigate	= $class_menu->getAllParentList("categories_multi", "cat_id", "cat_name", "cat_parent_id", $rowDetail["cat_id"], '<span class="sep"></span>', 1);
$header_navigate	.= '<span class="sep"></span><a href="' . $urlDetail . '">' . $rowDetail["new_title"] . '</a>';
unset($class_menu);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="<?=str_replace("\n", "", htmlspecialchars($con_meta_keywords))?>" />
<meta name="description" content="<?=str_replace("\n", "", htmlspecialchars($con_meta_description))?>" />
<link href="<?=$con_root_path?>css/standard/favicon.ico" rel="icon" type="image/x-icon" />
<link href="<?=$con_root_path?>css/standard/favicon.ico" rel="shortcut icon" />
<title><?=$con_site_title?></title>
<style type="text/css" media="all">@import "<?=$con_root_path?>css/FSmain.css";</style>
<style type="text/css" media="all">@import "<?=$con_root_path?>css/standard/FStheme.css";</style>
<style type="text/css" media="all">@import "<?=$con_root_path?>css/standard/FStemplate.css";</style>
</head>
<body>
<div id="body">
	<div id="container_body">
		<div id="container_body_wrapper">
			<div id="container_header"><? include($real_path . "includes/inc_header.php");?></div>
			<div id="container_content">
				<div id="container_content_center">
					<div class="container_content_center"><? include($real_path . "includes/inc_detail_news.php");?></div>
				</div>
				<div class="clear"></div>
			</div>
			<div id="container_footer"><? include($real_path . "includes/inc_footer.php");?></div>
		</div>
	</div>
</div>
</body>
</html>
<?
ob_end_flush();
?>